package com.heima.safe.aliyun.mq;

import com.heima.safe.aliyun.verify.VerifyText;
import org.apache.commons.lang3.StringUtils;


import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;

/**
 * @author mgw
 * @create 2021/10/6 19:44
 */

public class TextFutureResp implements Callable<List<Map<String, String>>> {
    //获取数据
    private Map<String,Object> dateMap;
    private VerifyText verifyText;

    public TextFutureResp(Map<String, Object> dateMap, VerifyText verifyText) {
        this.dateMap = dateMap;
        this.verifyText = verifyText;
    }

    @Override
    public List<Map<String, String>> call() throws Exception {
        List<String> text = (List<String>) dateMap.get("text");
        if (text!=null&&text.size()>0){
            TimeUnit.SECONDS.sleep(5);
            return verifyText.veirfy(StringUtils.join(text, ","));
        }
        return null;
    }
}
